package com.yf.zzmusic.pojo.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.time.ZoneOffset;

import lombok.Getter;
import lombok.Setter;

import javax.validation.constraints.NotNull;

/**
 * <p>
 * 专辑表
 * </p>
 *
 * @author
 * @since 2024-03-07
 */
@Getter
@Setter
@TableName("album")
public class Album implements Serializable {

  private static final long serialVersionUID = 1L;
  @TableId(value = "album_id", type = IdType.AUTO)
  private Integer albumId;

  /**
   * 专辑名称
   */
  @NotNull(message = "专辑名称不能为空")
  private String albumName;

  /**
   * 专辑封面
   */
  private String albumCover;

  /**
   * 歌手名称
   */
  @NotNull(message = "歌手名称不能为空")
  private String albumSingerName;

  /**
   * 歌手id
   */
  @NotNull(message = "歌手id不能为空")
  private Integer albumSingerId;

  /**
   * 专辑地区类型
   * 根据字典来
   */
  private Integer areaType;

  /**
   * 发行时间
   */
  private LocalDateTime albumTime;

  /**
   * 创建时间
   */
  private LocalDateTime createTime;

  public Long getAlbumTime() {
    if (albumTime != null) {
      long timestamp = albumTime.toInstant(ZoneOffset.of("+8")).toEpochMilli();
      return timestamp;
    } else {
      return null;
    }

  }

  public void setAlbumTime(LocalDateTime albumTime) {
    this.albumTime = albumTime;
  }

  public Long getCreateTime() {
    if (createTime != null) {
      long timestamp = createTime.toInstant(ZoneOffset.of("+8")).toEpochMilli();
      return timestamp;
    } else {
      return null;
    }
  }

  public void setCreateTime(LocalDateTime createTime) {
    this.createTime = createTime;
  }
}
